﻿#ifndef MARKABLEIMAGE_H
#define MARKABLEIMAGE_H

#include <QLabel>
#include <QMouseEvent>
#include <QPainter>
#include <QPixmap>

class MarkableImage : public QLabel
{
    Q_OBJECT

public:
    explicit MarkableImage(QWidget *parent = nullptr);
    // 设置背景图片
    void setBackgroundImage(const QString &imagePath);
    // 获取当前选中的点标号
    int getCurrentPointIndex() const;
    // 获取所有点的标号
    QVector<int> getAllPointLabels() const;

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *event) override;
signals:
    void pointSelected(const int &index);
private:
    QPixmap originalPixmap;
    QVector<QPoint> pointPositions;     // 存储13个标记点的位置
    QVector<int> pointLabels;           // 存储13个标记点的标号
    int currentPointIndex;              // 当前选中的点索引
    QPoint imageOffset;
};

#endif // MARKABLEIMAGE_H
